package remato.client.view.projecttree;

import static remato.client.controller.PrecisePluginImage.IMG_CREATE_REQUIREMENT;
import remato.client.controller.RequirementPlugin;
import remato.client.model.CategoryWrapper;
import remato.client.model.RequirementWrapper;
import remato.domain.common.Requirement;
/**
 * 
 * @author Petter L. H. Eide
 * @version $Id: CreateRequirementAction.java,v 1.2 2006-01-30 21:52:33 petterei Exp $
 */
public class CreateRequirementAction extends CreateAction<RequirementWrapper, CategoryWrapper> {

    public CreateRequirementAction(CategoryWrapper item) {
        super(createText(Requirement.class.getSimpleName()), item, IMG_CREATE_REQUIREMENT.getImageDescriptor());
    }

    /**
     * @see remato.client.view.projecttree.CrudAction#run()
     */
    @Override
    public void run() {
        Requirement domainProject = RequirementPlugin.getInstance().getSession().getDomainSession().createConcept(Requirement.class);
        RequirementWrapper item = RequirementPlugin.getInstance().getSession().getWrapperFactory().getWrapper(domainProject);
        item.setParent(getItem());
        setNewItem(item);
        super.run();
    }
    
}
